package com.github.sub.user;

import com.github.Common;
import com.github.sub.inter.ExeCommander;

import java.io.File;
import java.io.IOException;
import java.util.Map;

public class UserTokenCommander extends Common implements com.github.Commander {

    ExeCommander commander = new ExeCommander();

    @Override
    public Object run(Map<String, String> command) {
        String userName = command.get("-t");
        String fileName = (String) commander.run(command);
        File file = new File(userTemp);
        if (!file.exists()) {
            file.mkdirs();
        }
        file = new File(userTemp+ File.separator + userName);
        if (!file.exists()) {
            try {
                file.createNewFile();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        tradition.outPutFile(fileName.getBytes(), new File(userTemp + File.separator + userName));

        return null;
    }
}
